package com.zxkj.domain.mapper;

import com.zxkj.domain.dao.CommonDao;
import com.zxkj.domain.entity.CorporationTerm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/1/26.
 */
@Service
public class CorporationTermServiceImpl implements CorporationTermService {
    @Autowired
    private CommonDao commonDao;

    @Override
    public List<CorporationTerm> getAllByTermBase(List<String> termBaseList) {
        StringBuilder sb = new StringBuilder();
        sb.append("SELECT * FROM corporation_term ");
        sb.append("WHERE 1=2 ");
        for (String termBase : termBaseList) {
            sb.append("OR term_base LIKE '%" + termBase.replace("'","\\\' ") + "%' ");
        }
        List<CorporationTerm> list = (List<CorporationTerm>) commonDao.queryListEntity(sb.toString(), null, CorporationTerm.class);
        return list;
    }
}
